home *** CD-ROM | disk | FTP | other *** search
/ STraTOS 1997 April & May / STraTOS 1 - 1997 April & May.iso / CD01 / INTERNET / SITES / GRAHAM / XA_6S.ZIP / SOURCE / GETINFO.C < prev    next >
Encoding:
C/C++ Source or Header  |  1996-04-29  |  2.4 KB  |  111 lines

  1. /*
  2.  * XaAES - XaAES Ain't the AES
  3.  *
  4.  * A multitasking AES replacement for MiNT
  5.  *
  6.  */
  7.  
  8. #include <STRING.H>
  9. #include "XA_DEFS.H"
  10. #include "XA_TYPES.H"
  11. #include "XA_GLOBL.H"
  12. #include "getinfo.h"
  13. #include "K_DEFS.H"
  14.  
  15. /*
  16.     Data table for appl_getinfo
  17. */
  18.  
  19. short info_tab[15][4]={
  20.         {0,0,0,0},                                        /*0*/
  21.         {0,0,0,0},                                        /*1*/
  22.         {1,16,1,1},                                        /*2*/
  23.         {0,0,0,0},                                        /*3*/
  24.         {1,1,1,0},                                        /*4*/
  25.         {0,0,0,0},                                        /*5*/
  26.         {0,0,1,0},                                        /*6*/
  27.         {0,0,0,0},                        /* 7 isn't defined at the moment */
  28.         {0,1,0,0},                                        /*8*/
  29.         {0,0,0,1},                                        /*9*/
  30.         {0x0401,0,0,0},                                    /*10*/
  31.         {WF_TOP+WF_OWNER+WF_BOTTOM+WF_ICONIFY+WF_UNICONIFY,0,3,1},    /*11*/
  32.         {WM_UNTOPPED+WM_BOTTOM+WM_ICONIFY+WM_UNICONIFY,0,1,0},        /*12*/
  33.         {1,0,1,0},                                        /*13*/
  34.         {0,0,0,0}                                        /*14*/
  35.         };                                        
  36.  
  37. /*
  38.     appl_getinfo() handler
  39. */
  40. unsigned long XA_appl_getinfo(short clnt_pid, AESPB *pb)
  41. {
  42.     unsigned short gi_type=pb->intin[0];
  43.  
  44.     if ( gi_type>14 )
  45.     {
  46.         pb->intout[0] = 0 ;        /* "error" - unimplemented info type */
  47.         return XAC_DONE ;
  48.     }
  49.  
  50.     info_tab[0][0]=display.standard_font_height;
  51.      info_tab[0][1]=display.standard_font_id;
  52.     info_tab[1][0]=display.small_font_height;
  53.     info_tab[1][1]=display.small_font_id;
  54.  
  55.     pb->intout[0]=1;
  56.     pb->intout[1]=info_tab[gi_type][0];
  57.     pb->intout[2]=info_tab[gi_type][1];
  58.     pb->intout[3]=info_tab[gi_type][2];
  59.     pb->intout[4]=info_tab[gi_type][3];
  60.     
  61.     return XAC_DONE;
  62. }
  63.  
  64. /*
  65.     appl_find()
  66. */
  67. unsigned long XA_appl_find(short clnt_pid, AESPB *pb)
  68. {
  69.     unsigned short ex=(unsigned short)((unsigned long)pb->addrin[0]>>16)&0xffff;
  70.     char *name=(char*)pb->addrin[0],*t;
  71.     short f,n;
  72.  
  73.     if ((ex==0xffff)||(ex==0xfffe))
  74.     {
  75.         pb->intout[0]=(short)(((unsigned long)pb->addrin[0]))&0xffff;    /* In XaAES AES id == MiNT pid*/
  76.         return TRUE;
  77.     }
  78.     
  79.     if (!ex)
  80.     {
  81.         pb->intout[0]=clnt_pid;        /* Return the pid of current process */
  82.         return TRUE;
  83.     }
  84.     
  85. /* Tell application we understand appl_getinfo() */
  86. /* (invented by Martin Osieka for his AES extension WINX; used */
  87. /*    by MagiC 4, too.) */
  88.     if (strcmp(name, "?AGI")==0)
  89.     {
  90.         pb->intout[0]=0 ;        /* OK */
  91.         return TRUE ;
  92.     }
  93.  
  94.     for(f=0; f<MAX_PID; f++)
  95.     {
  96.         if (clients[f].clnt_pipe_rd)    /* Client active? */
  97.         {
  98.             t=clients[f].proc_name;
  99.             for(n=0; (n<8)&&(name[n]==t[n]); n++);
  100.             if(n==8)
  101.             {
  102.                 pb->intout[0]=f;
  103.                 return TRUE;
  104.             }
  105.         }
  106.     }
  107.     
  108.     pb->intout[0]=-1;
  109.     return TRUE;
  110. }
  111.